package connexion;

import java.io.IOException;
import java.io.Serializable;


public class IntegerMessage implements Message,Serializable {

	public static final String WIDTH_REASON = "width";
	public static final String HEIGHT_REASON = "height";
	public static final String PLACEMENT_REASON = "placement";
	public static final String AGENT_NUMBER = "agent number";
	public static final String DIRECTION = "direction";
	String reason;
	int value;
	String agent=null;
	String team=null;
	
	public IntegerMessage(String reason,String agent,int value)
	{
		this.reason=reason;
		this.value=value;
		this.agent=agent;
	}
	
	public IntegerMessage(String reason,String agent,String team,int value)
	{
		this.reason=reason;
		this.value=value;
		this.agent=agent;
		this.team=team;
	}
	
	public String agentConcerned() {
		return agent;
	}
	public int getValue()
	{
		return value;
	}
	
	public String toString()
	{return reason+" "+team+":"+agent+" "+value;}
	public String getReason() {
		return reason;
	}
	
	 protected void writeObject(java.io.ObjectOutputStream out)
     throws IOException{
		 out.writeObject(agent);
		 out.writeObject(reason);
		 out.writeInt(value);
		 out.writeObject(team);
		 
	 }
 protected void readObject(java.io.ObjectInputStream in)
     throws IOException, ClassNotFoundException
     {
	 agent=(String)in.readObject();
	 reason=(String)in.readObject();
	 value=in.readInt();
	 team=(String)in.readObject();
     }

public String getTeam() {
	return team;
}
}
